package com.fenghongzhang.login.mvp.model;

import com.fenghongzhang.login.Api;
import com.fenghongzhang.login.entity.LoginInfo;
import com.fenghongzhang.login.mvp.contract.LoginContract;
import com.fenghongzhang.login.util.HttpUtil;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

public class LoginModel implements LoginContract.ILoginModel {


    @Override
    public void login(String name,String password,Observer<LoginInfo> observer) {
        //发送请求

        HttpUtil.getHttpUtil()
                .getRetrofit()
                .create(Api.class)
                .login(name,password)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(observer);

    }

    @Override
    public void destroy() {
        //销毁链接
    }
}
